package com.ztom.v2;

/**
 * @author ZhangTao
 */
public class Code05ContainerWithMostWater {

    public int maxArea(int[] height) {
        int max = 0;
        int l = 0;
        int r = height.length - 1;
        while (l < r) {
            if (height[l] > height[r]) {
                max = Math.max(max, (r - l) * height[r]);
                r--;
            } else {
                max = Math.max(max, (r - l) * height[l]);
                l++;
            }
        }
        return max;
    }
}

